#include <iostream>
#include <vector>
using namespace std;

#define N 10005
typedef long long ll;

int n, loc[N], r[N], val[N];
ll dp[200000000];
int bound;

int main() {
    cin >> n;
    vector<vector<int>> aff;
    aff.resize(n);
    for (int i = 0; i < n; i++) { cin >> loc[i]; }
    for (int i = 0; i < n; ++i) {
        cin >> r[i];
        for (int i = loc[i] - r[i]; i <= loc[i] + r[i]; ++i) { 
            aff[i].push_back(i); 
        }
        if (loc[i] + r[i] > bound) bound = loc[i] + r[i];
    }


    for (int i = 0; i < n; ++i) { cin >> val[i]; }

    for (int i = 0; i < n; ++i) {
        int left = loc[i] - r[i];
        int right = loc[i] + r[i];
        for (int j = right; j <= bound; ++j) { dp[j] = max(dp[left] + val[i], dp[j]); }
    }

    cout << dp[bound] << endl;


    return 0;
}